import os
from time import sleep
from selenium import webdriver

# 打开浏览驱动器
driver = webdriver.Chrome()
driver.implicitly_wait(3)

# 将浏览器最大化
driver.maximize_window()

# 获取当前目录的selen.html文件
file_path = os.path.join('file:///', os.getcwd(), "selenium.html")
driver.get(file_path)
# 点击提交
form = driver.find_element_by_css_selector('div#signup form')
form.submit()

sleep(2)
# 弹窗处理
alert = driver.switch_to.alert
alert.accept()

sleep(2)
# 关闭浏览器
driver.quit()
